package com.aop.log.controller;

import com.aop.log.annotation.OperLog;
import com.aop.log.annotation.OprLogConst;
import com.aop.log.entity.OrderInfo;
import com.aop.log.entity.RespBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhaoz
 * @date 2024/4/24
 */
@Controller
public class OrderController {
    /**
     * 新增订单信息
     */
    @RequestMapping(value = "addOrderInfo")
    @ResponseBody
    @OperLog(operModul = "销售管理-订单新增", operType = OprLogConst.ADD, operDesc = "订单新增功能")
    public RespBean addOrderInfo(OrderInfo orderInfo) {
        if (orderInfo.getPrice() < 0) {
            System.out.println(1 / 0);
            return RespBean.error("提交失败!!!");
        } else if (orderInfo.getPrice() < 30) {
            return RespBean.success("提交成功!!!");
        } else {
            return RespBean.error("提交失败!!!");
        }
    }
}
